www.gusucode.com > Neutrosophic logic toolbox Package_ Neutrosophic Matrices > Neutrosophic logic toolbox Package_ Neutrosophic Matrices/@term/mtimes.m
function r = mtimes(p,q) % TERM/MTIMES Implement p * q for terms. % %In the Name of ALLAH % neutrosphic logic toolbox for computing single valued neutrosophic Matrice % Copyright (C) 2015-2019 Broumi said %for for details see the refrence: %Said Broumi, Le Hoang Son, Assia Bakali, Mohamed Talea, Florentin Smarandache, %Ganeshsree Selvachandran, Computing Operational Matrices in Neutrosophic Environments: %A Matlab Toolbox,Neutrosophic Sets and Systems, 18,2017,pp.58-66. % neutrosphic logic toolbox for computing single valued neutrosophic Matrice comes % This is free software, and you are welcome to redistribut;see license.txt for details. %k = length(q.n) - length(p.n); if (isa(p,'term')&(isa(q,'term'))) r=multterms(p,q); elseif (isa(p,'sterm')|(isa(q,'sterm'))) if ~isa(p,'sterm') p = sterm(p); end if ~isa(q,'sterm') q = sterm(q); end if (isa(p,'sterm')&(isa(q,'sterm'))) r=p*q; else r=[]; error(' error in conversion') end else if ~isa(p,'term') p = term(p); end if ~isa(q,'term') q = term(q); end if (isa(p,'term')&(isa(q,'term'))) r=multterms(p,q); else r=[]; error(' error in conversion ') end end function r=multterms(p,q) for ip=1:length(p) r=q; isdone=0; % 1 if the p(ip) element is already multipliciert for iq=1:length(q) if p(ip).d==q(iq).d r(iq).n=max(p(ip).n,q(iq).n); isdone=1; end end if ~isdone r(iq+1).n=p(ip).n; r(iq+1).d=p(ip).d; end q=r; end r=term(r);